import request from '../utils/request';

// 用户登录
export async function userLogin(params) {
  return request('/api/user/login', {
    method: 'POST',
    body: params,
  });
}

// 用户注册
export async function userRegister(params) {
  return request('/api/user/register', {
    method: 'POST',
    body: params,
  });
}

// 用户修改
export async function userEdit(params) {
  return request('/api/edit', {
    method: 'POST',
    body: params,
  });
}

// su
export async function findSu() {
  return request('/api/user/su/find', {
    method: 'GET',
  });
}

export async function updateSu(body) {
  return request('/api/user/su/update', {
    method: 'POST',
    body,
  });
}
export async function findUserByUsername(body) {
  return request('/api/user/find/byUsername', {
    method: 'POST', body,
  });
}
export async function findUser(body) {
  return request('/api/user/find', {
    method: 'POST', body,
  });
}

export async function updateUser(body) {
  return request('/api/user/update', {
    method: 'POST', body,
  });
}

/**
 * 重置密码
 * @param body
 * @returns {Promise<unknown>}
 */
export async function resetPassword(body) {
  return request('/api/user/password/reset', {
    method: 'POST', body,
  });
}
/**
 * 更新密码
 * @param body
 * @returns {Promise<unknown>}
 */
export async function updatePassword(body) {
  return request('/api/user/password/update', {
    method: 'POST', body,
  });
}
export async function findUsers(body) {
  return request('/api/user/find/all', {
    method: 'POST',
    body,
  });
}
export async function findUsersByPage(body) {
  return request('/api/user/find/page', {
    method: 'POST', body,
  });
}
export async function deleteUser(body) {
  return request('/api/user/delete', {
    method: 'POST',
    body,
  });
}
